﻿<!--#include file="app/inc/conn.asp"-->
<!--#include file="app/inc/md5.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="copyright" content="Copyright (c) 2008-2009 ujobok.com" />
<meta name="description" content="" />
<meta name="Keywords" content="" />
<title>招聘会</title>
<script type="text/javascript" src="app/import-city-js.asp?<%=Md5(Year(Now())&Month(Now())&Day(Now)&Hour(Now())&Minute(Now())&Second(Now()),16)%>"></script>
</head>

<body>
<%
Call opendata()
set rscount = conn.execute("select count(id) from city where recommed = true")
response.write rscount(0)
set rscount = nothing
response.end
sql = "select id,city from sexy"
set rs = server.createobject("adodb.recordset")
rs.open sql,conn,1,1
do while not rs.eof
	id = rs("id")
	city = left(rs("city"),2)
	call setCityID(id,city)
	rs.movenext
loop
rs.close
set rs = nothing

sub setCityID(idnum,citystr)
	cityIDStr = getCityID(citystr)
	cityIDArr = split(cityIDStr,"|")
	cityID = cint(cityIDArr(0))
	rootID = cint(cityIDArr(1))
	'response.write "update sexy set cityid = "&cityID&" and cityrootid = "&rootid&" where id ="&idnum
	'response.end
	conn.execute("update sexy set cityrootid = "&rootid&" where id ="&idnum)
end sub
function getCityID(citystr)
	'response.write "select id,rootid from city where cityname like '%"&citystr&"%'"
	'response.end
	set rsGetCityID = conn.execute("select id,rootid from city where cityname like '%"&citystr&"%'")
		getCityID = rsGetCityID(0) & "|" & rsGetCityID(1)
	set rsGetCityID = nothing
end function
call closedata()
%>
</body>
</html>
